home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual dBase v5.5 / MUSIC1.PAK / MUSIVIEW.WFM < prev    next >
Encoding:
Text File  |  1995-07-18  |  33.2 KB  |  1,130 lines

  1. *******************************************************************************
  2. *  PROGRAM:      Musiview.wfm
  3. *
  4. *  WRITTEN BY:   Borland Samples Group
  5. *
  6. *  DATE:         1/94
  7. *
  8. *  UPDATED:      5/95
  9. *
  10. *  REVISION:     $Revision:   1.49  $
  11. *
  12. *  VERSION:      Visual dBASE
  13. *
  14. *  DESCRIPTION:  This is a form displaying the general view of all music
  15. *                and other items sold in the Musical Methods store.  You can
  16. *                view this form in either edit or browse mode, change the
  17. *                order of its display, view more or less information, depending
  18. *                on your preference, search, and set a filter on the viewed
  19. *                information.  You can also view a report of the top 10.20 artists.
  20. *
  21. *  PARAMETERS:   None
  22. *
  23. *  CALLS:        Music.qbe     (view of tables)
  24. *                Music.cc      (for custom pushbuttons)
  25. *                View.mnu      (menu file)
  26. *                View.pop      (popup file)
  27. *                Music.prg     (procedure file)
  28. *
  29. *  USAGE:        DO Musiview.wfm
  30. *
  31. *******************************************************************************
  32. #include <Messdlg.h>
  33. #include "Music.h"
  34. extern CINT WaveOutGetNumDevs( CVOID ) MmSystem.dll  && Checks sound driver
  35.  
  36. create session
  37. set talk off
  38. set ldcheck off
  39.  
  40. ** END HEADER -- do not remove this line*
  41. * Generated on 07/11/95
  42. *
  43. parameter bModal
  44. local f
  45. f = new MUSIVIEWFORM()
  46. if (bModal)
  47.    f.mdi = .F. && ensure not MDI
  48.    f.ReadModal()
  49. else
  50.    f.Open()
  51. endif
  52. CLASS MUSIVIEWFORM OF FORM
  53.    Set Procedure To &_dbwinhome.samples\music\MUSIC.CC additive
  54.    this.OnOpen = CLASS::ONOPEN
  55.    this.Minimize = .F.
  56.    this.MousePointer = 1
  57.    this.ColorNormal = "W"
  58.    this.OnClose = CLASS::ONCLOSE
  59.    this.Maximize = .F.
  60.    this.Top = 0.4111
  61.    this.MenuFile = "VIEW.MNU"
  62.    this.Left = 3.5
  63.    this.Text = "Music -- Edit"
  64.    this.OnNavigate = CLASS::ONNAVIGATE
  65.    this.View = "MUSIC.QBE"
  66.    this.Height = 18.7646
  67.    this.Width = 79.5
  68.  
  69.    DEFINE RECTANGLE EDITRECT1 OF THIS;
  70.        PROPERTY;
  71.          ColorNormal "N/W",;
  72.          Text "",;
  73.          BorderStyle 1,;
  74.          Height 5.3525,;
  75.          Width 79.5
  76.  
  77.    DEFINE RECTANGLE EDITRECT2 OF THIS;
  78.        PROPERTY;
  79.          ColorNormal "N/W",;
  80.          Top 5.3486,;
  81.          Text "",;
  82.          BorderStyle 1,;
  83.          Height 11.2979,;
  84.          Width 79.5
  85.  
  86.    DEFINE EMPHASIZEDTEXT RANKTEXT OF THIS;
  87.        PROPERTY;
  88.          Top 0.8984,;
  89.          Left 3.2295,;
  90.          Text "Rank:",;
  91.          Alignment 5,;
  92.          FontSize 10,;
  93.          FontBold .F.,;
  94.          Height 1.2773,;
  95.          Width 16.1035
  96.  
  97.    DEFINE EMPHASIZEDENTRY RANKENTRY OF THIS;
  98.        PROPERTY;
  99.          Top 0.8984,;
  100.          Left 20.2295,;
  101.          FontSize 10,;
  102.          Enabled .F.,;
  103.          DataLink "RANK",;
  104.          Height 1.2773,;
  105.          Function "B",;
  106.          Width 11.9365
  107.  
  108.    DEFINE MUSICBUTTON SOUNDBUTTON OF THIS;
  109.        PROPERTY;
  110.          Group .T.,;
  111.          Top 0.3984,;
  112.          StatusMessage "Listen to a sample of the recorded music.",;
  113.          Default .T.,;
  114.          Left 47.0986,;
  115.          Text "S&le",;
  116.          OnClick CLASS::PLAYSOUND,;
  117.          UpBitmap "RESOURCE #618",;
  118.          Height 1.4834,;
  119.          Width 14.2344,;
  120.          SpeedTip "Listen to sample"
  121.  
  122.    DEFINE MUSICBUTTON COVERBUTTON OF THIS;
  123.        PROPERTY;
  124.          Group .T.,;
  125.          Top 0.3984,;
  126.          StatusMessage "Look at the album cover.",;
  127.          Left 62.3887,;
  128.          Text "&Cover",;
  129.          OnClick CLASS::SHOWCOVER,;
  130.          UpBitmap "RESOURCE #617",;
  131.          Height 1.4834,;
  132.          Width 14.1113,;
  133.          SpeedTip "Look at album cover"
  134.  
  135.    DEFINE EMPHASIZEDTEXT ARTISTTEXT OF THIS;
  136.        PROPERTY;
  137.          Top 2.2891,;
  138.          Left 3.2295,;
  139.          Text "Artist:",;
  140.          Alignment 5,;
  141.          FontSize 10,;
  142.          FontBold .F.,;
  143.          Height 1.2988,;
  144.          Width 16.1035
  145.  
  146.    DEFINE EMPHASIZEDENTRY ARTISTENTRY OF THIS;
  147.        PROPERTY;
  148.          Top 2.2891,;
  149.          Left 20.2295,;
  150.          FontSize 10,;
  151.          Enabled .F.,;
  152.          DataLink "ARTIST",;
  153.          Height 1.2988,;
  154.          Width 57.2705
  155.  
  156.    DEFINE EMPHASIZEDTEXT TITLETEXT OF THIS;
  157.        PROPERTY;
  158.          Top 3.5781,;
  159.          Left 3.2295,;
  160.          Text "Title:",;
  161.          Alignment 5,;
  162.          FontSize 10,;
  163.          FontBold .F.,;
  164.          Height 1.3037,;
  165.          Width 16.1035
  166.  
  167.    DEFINE EMPHASIZEDENTRY TITLEENTRY OF THIS;
  168.        PROPERTY;
  169.          Top 3.5781,;
  170.          Left 20.2295,;
  171.          FontSize 10,;
  172.          Enabled .F.,;
  173.          DataLink "TITLE",;
  174.          Height 1.3037,;
  175.          Width 57.2705
  176.  
  177.    DEFINE NORMALTEXT DESCRIPTIONTEXT OF THIS;
  178.        PROPERTY;
  179.          Top 5.8184,;
  180.          Left 1.1895,;
  181.          Text "Description:",;
  182.          Alignment 5,;
  183.          FontBold .F.,;
  184.          Height 1.2402,;
  185.          Width 16.1436
  186.  
  187.    DEFINE NORMALENTRY DESCRIPTIONENTRY1 OF THIS;
  188.        PROPERTY;
  189.          Top 5.8184,;
  190.          Left 18.1895,;
  191.          Enabled .F.,;
  192.          DataLink "DESCRIPT1",;
  193.          Height 1.2402,;
  194.          Width 59.3105
  195.  
  196.    DEFINE NORMALENTRY DESCRIPTIONENTRY2 OF THIS;
  197.        PROPERTY;
  198.          Top 7.1387,;
  199.          Left 18.1895,;
  200.          Enabled .F.,;
  201.          DataLink "DESCRIPT2",;
  202.          Height 1.2725,;
  203.          Width 59.3105
  204.  
  205.    DEFINE NORMALTEXT CATEGORYTEXT OF THIS;
  206.        PROPERTY;
  207.          Top 8.5186,;
  208.          Left 1.1895,;
  209.          Text "Category:",;
  210.          Alignment 5,;
  211.          FontBold .F.,;
  212.          Height 1.2461,;
  213.          Width 16.1436
  214.  
  215.    DEFINE NORMALENTRY CATEGORYENTRY OF THIS;
  216.        PROPERTY;
  217.          Top 8.5186,;
  218.          Left 18.1895,;
  219.          Enabled .F.,;
  220.          DataLink "CATEGORS->DESCRIPT",;
  221.          Height 1.2461,;
  222.          Width 59.3105
  223.  
  224.    DEFINE NORMALTEXT PRIORITYTEXT OF THIS;
  225.        PROPERTY;
  226.          Top 9.8486,;
  227.          Left 1.1895,;
  228.          Text "Sales Ranking:",;
  229.          Alignment 5,;
  230.          FontBold .F.,;
  231.          Height 1.2686,;
  232.          Width 16.1436
  233.  
  234.    DEFINE NORMALENTRY PRIORITYENTRY OF THIS;
  235.        PROPERTY;
  236.          Top 9.8486,;
  237.          Left 18.1895,;
  238.          Enabled .F.,;
  239.          DataLink "PRIORITS->DESCRIPT",;
  240.          Height 1.2686,;
  241.          Width 59.3105
  242.  
  243.    DEFINE NORMALTEXT CONFIGURATIONTEXT OF THIS;
  244.        PROPERTY;
  245.          Top 11.2988,;
  246.          Left 1.1895,;
  247.          Text "Media Type:",;
  248.          Alignment 5,;
  249.          FontBold .F.,;
  250.          Height 1.2305,;
  251.          Width 16.1436
  252.  
  253.    DEFINE NORMALENTRY CONFIGURATIONENTRY OF THIS;
  254.        PROPERTY;
  255.          Top 11.2988,;
  256.          Left 18.1895,;
  257.          Enabled .F.,;
  258.          DataLink "CONFIGS->DESCRIPT",;
  259.          Height 1.2305,;
  260.          Width 43.8105
  261.  
  262.    DEFINE NORMALTEXT LISTPRICETEXT OF THIS;
  263.        PROPERTY;
  264.          Top 12.6895,;
  265.          Left 1.1895,;
  266.          Text "Sales Price:",;
  267.          Alignment 5,;
  268.          FontBold .F.,;
  269.          Height 1.251,;
  270.          Width 16.1436
  271.  
  272.    DEFINE NORMALENTRY LISTPRICEENTRY OF THIS;
  273.        PROPERTY;
  274.          Picture "999.99",;
  275.          Top 12.6895,;
  276.          Left 18.1895,;
  277.          Enabled .F.,;
  278.          DataLink "LIST_PRICE",;
  279.          Height 1.0752,;
  280.          Function "$B",;
  281.          Width 9.8105
  282.  
  283.    DEFINE NORMALTEXT STREETDATETEXT OF THIS;
  284.        PROPERTY;
  285.          Top 12.6895,;
  286.          Left 30.5986,;
  287.          Text "Release Date:",;
  288.          Alignment 5,;
  289.          FontBold .F.,;
  290.          Height 1.1924,;
  291.          Width 16.2344
  292.  
  293.    DEFINE NORMALENTRY STREETDATEENTRY OF THIS;
  294.        PROPERTY;
  295.          Top 12.6895,;
  296.          Left 47.2598,;
  297.          Enabled .F.,;
  298.          DataLink "STREET_DT",;
  299.          Height 1.251,;
  300.          Width 14.7402
  301.  
  302.    DEFINE PREVMBUTTON PREVMUSICBUTTON OF THIS;
  303.        PROPERTY;
  304.          Group .T.,;
  305.          Top 14.2793,;
  306.          Left 3.2295,;
  307.          Text "&Prev",;
  308.          OnClick CLASS::PREVBUTTONONCLICK,;
  309.          Height 1.4854,;
  310.          Width 14.1035
  311.  
  312.    DEFINE NEXTMBUTTON NEXTMUSICBUTTON OF THIS;
  313.        PROPERTY;
  314.          Group .T.,;
  315.          Top 14.2793,;
  316.          Left 18.1895,;
  317.          Text "&Next",;
  318.          OnClick CLASS::NEXTBUTTONONCLICK,;
  319.          Height 1.4854,;
  320.          Width 14.1436
  321.  
  322.    DEFINE MUSICBUTTON TOPMUSICBUTTON OF THIS;
  323.        PROPERTY;
  324.          Group .T.,;
  325.          Top 14.2793,;
  326.          StatusMessage "Go to the first item in the current order.",;
  327.          Left 32.9795,;
  328.          Text "&Top",;
  329.          OnClick CLASS::TOPBUTTONONCLICK,;
  330.          Height 1.4854,;
  331.          Width 14.1865,;
  332.          SpeedTip "First item in current order"
  333.  
  334.    DEFINE MUSICBUTTON BOTTOMMUSICBUTTON OF THIS;
  335.        PROPERTY;
  336.          Group .T.,;
  337.          Top 14.2793,;
  338.          StatusMessage "Go to the last item in the current order.",;
  339.          Left 47.9395,;
  340.          Text "&Bottom",;
  341.          OnClick CLASS::BOTTOMBUTTONONCLICK,;
  342.          Height 1.4854,;
  343.          Width 14.2266,;
  344.          SpeedTip "Last item in current order"
  345.  
  346.    DEFINE MUSICBUTTON MOREMUSICBUTTON OF THIS;
  347.        PROPERTY;
  348.          Group .F.,;
  349.          HelpID "More",;
  350.          Top 14.2793,;
  351.          StatusMessage "See more information.  Press F1 for Help.",;
  352.          Left 62.7295,;
  353.          Text "&More...",;
  354.          OnClick CLASS::MORE,;
  355.          Height 1.4854,;
  356.          HelpFile "Music.hlp",;
  357.          Width 14.1035,;
  358.          SpeedTip "See more information"
  359.  
  360.    DEFINE CLOSEMBUTTON CLOSEMUSICBUTTON OF THIS;
  361.        PROPERTY;
  362.          Group .T.,;
  363.          Top 17.0488,;
  364.          Left 32.9795,;
  365.          Height 1.5391,;
  366.          Width 14.1865
  367.  
  368.    DEFINE IMAGE LOGOIMAGE OF THIS;
  369.        PROPERTY;
  370.          Top 0.7188,;
  371.          Left 0.5098,;
  372.          Alignment 2,;
  373.          DataSource "FILENAME SMLMUSIC.BMP",;
  374.          Height 3.8105,;
  375.          Width 9.9902
  376.  
  377.    DEFINE NORMALTEXT CATALOGTEXT OF THIS;
  378.        PROPERTY;
  379.          Top 1.0186,;
  380.          Left 82.4395,;
  381.          Visible .F.,;
  382.          Text "Catalog:",;
  383.          Alignment 3,;
  384.          Height 0.9814,;
  385.          Width 13.5605
  386.  
  387.    DEFINE NORMALENTRY CATALOGENTRY OF THIS;
  388.        PROPERTY;
  389.          Picture "9999999",;
  390.          Top 2.0391,;
  391.          Left 82.4395,;
  392.          Visible .F.,;
  393.          DataLink "MUSIC->CATALOG",;
  394.          Height 1.0195,;
  395.          Function "B",;
  396.          Width 13.5605
  397.  
  398.    DEFINE NORMALTEXT UPCTEXT OF THIS;
  399.        PROPERTY;
  400.          Top 4.0781,;
  401.          Left 82.4395,;
  402.          Visible .F.,;
  403.          Text "UPC:",;
  404.          Alignment 3,;
  405.          Height 0.9805,;
  406.          Width 13.5605
  407.  
  408.    DEFINE NORMALENTRY UPCENTRY OF THIS;
  409.        PROPERTY;
  410.          Top 5.0986,;
  411.          Left 82.4395,;
  412.          Visible .F.,;
  413.          DataLink "MUSIC->UPC",;
  414.          Height 1.0186,;
  415.          Width 13.5605
  416.  
  417.    DEFINE NORMALTEXT LABELTEXT OF THIS;
  418.        PROPERTY;
  419.          Top 7.1387,;
  420.          Left 82.4395,;
  421.          Visible .F.,;
  422.          Text "Label No:",;
  423.          Alignment 3,;
  424.          Height 0.9785,;
  425.          Width 13.5605
  426.  
  427.    DEFINE NORMALENTRY LABELENTRY OF THIS;
  428.        PROPERTY;
  429.          Top 8.1592,;
  430.          Left 82.4395,;
  431.          Visible .F.,;
  432.          DataLink "LABEL",;
  433.          Height 1.0166,;
  434.          Width 13.5605
  435.  
  436.    DEFINE NORMALTEXT LABELABBRTEXT OF THIS;
  437.        PROPERTY;
  438.          Top 10.1982,;
  439.          Left 82.4395,;
  440.          Visible .F.,;
  441.          Text "Label:",;
  442.          Alignment 3,;
  443.          Height 0.9775,;
  444.          Width 13.5605
  445.  
  446.    DEFINE NORMALENTRY LABELABBRENTRY OF THIS;
  447.        PROPERTY;
  448.          Top 11.2188,;
  449.          Left 82.4395,;
  450.          Visible .F.,;
  451.          DataLink "MUSIC->LABEL_ABBR",;
  452.          Height 1.251,;
  453.          Width 13.5605
  454.  
  455.    DEFINE NORMALTEXT VPCTEXT OF THIS;
  456.        PROPERTY;
  457.          Top 13.2598,;
  458.          Left 82.4395,;
  459.          Visible .F.,;
  460.          Text "VPC:",;
  461.          Alignment 3,;
  462.          Height 0.9746,;
  463.          Width 13.5605
  464.  
  465.    DEFINE NORMALENTRY VPCENTRY OF THIS;
  466.        PROPERTY;
  467.          Top 14.2793,;
  468.          Left 82.4395,;
  469.          Visible .F.,;
  470.          DataLink "MUSIC->VPC",;
  471.          Height 1.25,;
  472.          Width 13.5605
  473.  
  474.    DEFINE RECTANGLE DIVIDERRECT OF THIS;
  475.        PROPERTY;
  476.          ColorNormal "N/W",;
  477.          Top -0.5,;
  478.          Left 81.0889,;
  479.          Visible .F.,;
  480.          Text "Rectangle1",;
  481.          Height 22.5586,;
  482.          Width 0.2441
  483.  
  484.    procedure OnOpen
  485.    ******************************************************************************
  486.  
  487.    if _app.framewin.text = MUSIC_APP_TITLE    && If called from Music.prg
  488.       EnableViews(this)                       && enable viewing other items,
  489.       trackWindows.AddWindow(form)            && Window adding paperwork
  490.    else                                       && otherwise
  491.       set procedure to Music.prg additive     && Make Music.prg procedure file
  492.    endif
  493.  
  494.    *** Define Browse view controls (invisible at first)
  495.    CLASS::DefineBrowseView()
  496.  
  497.    *** View Window Settings
  498.    this.saveHeight = this.height              && When form resized, original
  499.    this.saveSmallWidth = this.width           && size is restored
  500.    this.saveLargeWidth = 100.0
  501.  
  502.    this.OnSize = CLASS::EditViewOnSize
  503.  
  504.    *** Assign the SpeedMenu for this form
  505.    set procedure to View.pop additive
  506.    this.popupMenu = new ViewPopup(this, "ViewPopup")
  507.  
  508.    *** Menu Settings
  509.    this.root.AssignWindowMenu()
  510.  
  511.    *** Do calculations in another workarea so form is not affected
  512.    use music in select() order rank alias temp
  513.    go bottom in temp
  514.    this.lastRec = recno("temp")
  515.    go top in temp
  516.    this.firstRec = recno("temp")
  517.    use in temp
  518.    ***
  519.  
  520.    this.filter = ""                           && No filter assigned yet
  521.    this.inEditView = .T.                      && Start in Edit view
  522.  
  523.    *** Keep track of the current display order
  524.    this.orderText = this.rankText
  525.    this.orderEntry = this.rankEntry
  526.    this.orderMenu = this.Root.View.Organization.Rank
  527.    this.speedOrderMenu = this.popupMenu.Organization.Rank
  528.    this.TopMusicButton.OnClick()              && Go to first record in
  529.                                               && current order
  530.  
  531.  
  532.    ******************************************************************************
  533.  
  534.    procedure OnClose
  535.    ******************************************************************************
  536.  
  537.    if _app.framewin.text = MUSIC_APP_TITLE    && If running whole app, delete
  538.       trackWindows.DeleteWindow(form)         && form reference from
  539.    else                                       && trackWindows object
  540.       close procedure Music.prg
  541.    endif
  542.    close procedure Music.cc, View.pop
  543.  
  544.  
  545.    ******************************************************************************
  546.  
  547.    procedure DefineBrowseView
  548.  
  549.    * Creates Browse view of available items.  All browse controls are initially
  550.    * created to be invisible -- form starts out in Edit view.
  551.    ******************************************************************************
  552.  
  553.    DEFINE RECTANGLE BROWSERECT OF form;
  554.       PROPERTY;
  555.          Top 0.10,;
  556.          Left 0.01,;
  557.          Height form.height - 3,;
  558.          Width form.width -.2,;
  559.          Text "",;
  560.          BorderStyle 0,;
  561.          Before form.logoImage,;
  562.          ColorNormal "W",;
  563.          Visible .F.
  564.  
  565.    DEFINE BROWSE MUSICBROWSE OF form;
  566.       PROPERTY;
  567.          Modify .F.,;
  568.          ColorNormal "r/w",;
  569.          ShowRecNo .F.,;
  570.          Alias "Music",;
  571.          Top form.browseRect.top + .5,;
  572.          Left form.browseRect.left + 13,;
  573.          Width form.browseRect.width - 14,;
  574.          Height form.browseRect.height - 1,;
  575.          Visible .F.
  576.  
  577.    form.musicBrowse.fields =;
  578.       "rank, artist, title, categors->descript\h='MUSIC CATEGORY', configs->descript\h='MEDIA TYPE', priorits->descript\h='SALES RANKING', list_price\h='PRICE', street_dt\h='RELEASE DATE'\p='J', descript1\h='DESCRIPTION1', descript2\h='DESCRIPTION2'"
  579.  
  580.    DEFINE CLOSEMBUTTON BROWSECLOSEBUTTON OF form;
  581.       PROPERTY;
  582.          Top          form.height - 2.02,;
  583.          Left         PB_COLUMN(form.width,"  Close   ",1,1),;
  584.          Visible .F.
  585.  
  586.  
  587.    *******************************************************************************
  588.  
  589.    procedure EditView
  590.  
  591.    * Create Edit view of available items.
  592.    * OnClick routine for BROWSE menu.
  593.    *******************************************************************************
  594.    private menu, speedMenu
  595.  
  596.    form.BrowseViewRelease()                   && Release Browse view controls
  597.    form.inEditView = .T.
  598.  
  599.    form.text = "Music -- Edit"                && Make title corresponding to window
  600.  
  601.    form.editRect1.visible = .T.
  602.    form.editRect2.visible = .T.
  603.    form.rankText.visible = .T.
  604.    form.rankEntry.visible = .T.
  605.    form.soundButton.visible = .T.
  606.    form.coverButton.visible = .T.
  607.    form.artistText.visible = .T.
  608.    form.artistEntry.visible = .T.
  609.    form.titleText.visible = .T.
  610.    form.titleEntry.visible = .T.
  611.    form.descriptionText.visible = .T.
  612.    form.descriptionEntry1.visible = .T.
  613.    form.descriptionEntry2.visible = .T.
  614.    form.categoryText.visible = .T.
  615.    form.categoryEntry.visible = .T.
  616.    form.configurationText.visible = .T.
  617.    form.configurationEntry.visible = .T.
  618.    form.priorityText.visible = .T.
  619.    form.priorityEntry.visible = .T.
  620.    form.listPriceText.visible = .T.
  621.    form.listPriceEntry.visible = .T.
  622.    form.streetDateText.visible = .T.
  623.    form.streetDateEntry.visible = .T.
  624.    form.prevMusicButton.visible = .T.
  625.    form.nextMusicButton.visible = .T.
  626.    form.topMusicButton.visible = .T.
  627.    form.bottomMusicButton.visible = .T.
  628.    form.closeMusicButton.visible = .T.
  629.    form.moreMusicButton.visible = .T.
  630.    if form.moreMusicButton.text = "L&ess"       && Show expanded view
  631.       CLASS::More()
  632.    endif
  633.  
  634.    CLASS::ReassignOrder(form)
  635.    form.OnSize = form.EditViewOnSize
  636.    form.OnNavigate()
  637.  
  638.    menu = form.root.view.browse
  639.    speedMenu = form.popupMenu.browse
  640.  
  641.    menu.text = "&Browse"
  642.    speedMenu.text = "&Browse"
  643.    menu.OnClick = CLASS::BrowseView  && Switch to Browse view next time
  644.    speedMenu.OnClick = CLASS::BrowseView
  645.  
  646.  
  647.  
  648.    *******************************************************************************
  649.  
  650.    procedure EditViewRelease
  651.  
  652.    * Procedure called when view of this form is switched from Edit to Browse
  653.    *******************************************************************************
  654.  
  655.    if form.moreMusicButton.text = "L&ess"
  656.       CLASS::Less()
  657.    endif
  658.  
  659.    * Make all Edit view controls invisible
  660.    form.editRect1.visible = .F.
  661.    form.editRect2.visible = .F.
  662.    form.rankText.visible = .F.
  663.    form.rankEntry.visible = .F.
  664.    form.soundButton.visible = .F.
  665.    form.coverButton.visible = .F.
  666.    form.artistText.visible = .F.
  667.    form.artistEntry.visible = .F.
  668.    form.titleText.visible = .F.
  669.    form.titleEntry.visible = .F.
  670.    form.descriptionText.visible = .F.
  671.    form.descriptionEntry1.visible = .F.
  672.    form.descriptionEntry2.visible = .F.
  673.    form.categoryText.visible = .F.
  674.    form.categoryEntry.visible = .F.
  675.    form.configurationText.visible = .F.
  676.    form.configurationEntry.visible = .F.
  677.    form.priorityText.visible = .F.
  678.    form.priorityEntry.visible = .F.
  679.    form.listPriceText.visible = .F.
  680.    form.listPriceEntry.visible = .F.
  681.    form.streetDateText.visible = .F.
  682.    form.streetDateEntry.visible = .F.
  683.    form.prevMusicButton.visible = .F.
  684.    form.nextMusicButton.visible = .F.
  685.    form.topMusicButton.visible = .F.
  686.    form.bottomMusicButton.visible = .F.
  687.    form.closeMusicButton.visible = .F.
  688.    form.moreMusicButton.visible = .F.
  689.  
  690.  
  691.  
  692.    ******************************************************************************
  693.  
  694.    procedure EditViewOnSize
  695.  
  696.    * Procedure called whenever form is resized in Edit view.
  697.    * Form is kept to a default size whenever it is resized.
  698.    ******************************************************************************
  699.  
  700.    form.height = form.saveHeight
  701.    form.width = iif(form.moreMusicButton.text = "L&ess",;
  702.                        form.saveLargeWidth,;
  703.                        form.saveSmallWidth)
  704.  
  705.  
  706.  
  707.  
  708.    ******************************************************************************
  709.  
  710.    procedure BrowseView
  711.  
  712.    * Creates Browse view of available items.
  713.    * OnClick routine for BROWSE menu.
  714.    ******************************************************************************
  715.    private menu, speedMenu
  716.  
  717.    form.EditViewRelease()                       && Don't show Edit view controls
  718.  
  719.    form.inEditView = .F.
  720.    form.text = "Music -- Browse"
  721.    form.OnSize = CLASS::BrowseViewOnSize        && Different size routine
  722.  
  723.    form.browseRect.visible = .T.                && Show Browse view controls
  724.    form.musicBrowse.visible = .T.
  725.    form.browseCloseButton.visible = .T.
  726.  
  727.    show object form.musicBrowse                 && Update Browse control
  728.  
  729.    menu = form.root.view.browse
  730.    speedMenu = form.popupMenu.browse
  731.    menu.text = "&Edit"                          && Next menu click show Edit
  732.    speedMenu.text = "&Edit"                     && view
  733.    menu.OnClick = CLASS::EditView
  734.    speedMenu.OnClick = CLASS::EditView
  735.  
  736.  
  737.  
  738.    ******************************************************************************
  739.  
  740.    procedure BrowseViewRelease
  741.  
  742.    * Procedure called when view of this form is switched from Browse to Edit
  743.    ******************************************************************************
  744.  
  745.    form.browseRect.visible = .F.
  746.    form.musicBrowse.visible = .F.
  747.    form.browseCloseButton.visible = .F.
  748.  
  749.  
  750.    ******************************************************************************
  751.  
  752.    procedure BrowseViewOnSize
  753.  
  754.    * Procedure called whenever form is resized in Browse view.
  755.    * Form is kept to a default size whenever it is resized.
  756.    ******************************************************************************
  757.  
  758.    form.browseCloseButton.left = PB_COLUMN(form.width,;
  759.                                     form.browseCloseButton.text, 1, 1)
  760.    form.browseCloseButton.top  = form.height - 2.02
  761.    form.browseRect.height = form.height - 3
  762.    form.browseRect.width = form.width - .2
  763.    form.musicBrowse.height = form.browseRect.height - 1
  764.    form.musicBrowse.width = form.browseREct.width - 14
  765.  
  766.  
  767.    *******************************************************************************
  768.  
  769.    procedure PlaySound
  770.  
  771.    * Play sample of music for the current album
  772.    *******************************************************************************
  773.  
  774.    if .not. empty(music->sound)
  775.       if WaveOutGetNumDevs() = 0           && If no sound driver, give warning
  776.          InformationMessage(;
  777.             "A sound driver is required to listen to a music sample.",;
  778.             "Information")
  779.       else
  780.          play sound binary music->sound
  781.       endif
  782.    else
  783.       InformationMessage("There is no music sample available for this album.",;
  784.          "Information")
  785.    endif
  786.  
  787.  
  788.    *******************************************************************************
  789.  
  790.    procedure ShowCover
  791.  
  792.    * Display the cover for the current music album
  793.    *******************************************************************************
  794.    local coverForm
  795.  
  796.    if .not. empty(music->cover)
  797.       coverForm = new ImageForm()          && This class is defined in this file
  798.       coverForm.ReadModal()
  799.    else
  800.       InformationMessage("The cover for this album is not available.",;
  801.          "Information")
  802.    endif
  803.  
  804.  
  805.    *******************************************************************************
  806.  
  807.    procedure PrevButtonOnclick
  808.  
  809.    * Skip to the previous record until bof()
  810.    *******************************************************************************
  811.  
  812.    if recno() <> form.firstRec
  813.       skip -1
  814.    endif
  815.  
  816.  
  817.    *******************************************************************************
  818.  
  819.    procedure NextButtonOnclick
  820.  
  821.    * Skip to the next record, until eof()
  822.    *******************************************************************************
  823.  
  824.    if recno() <> form.lastRec
  825.       skip
  826.    endif
  827.  
  828.  
  829.    *******************************************************************************
  830.  
  831.    procedure TopButtonOnClick
  832.  
  833.    * Go to first record in current order
  834.    *******************************************************************************
  835.  
  836.    go top
  837.  
  838.  
  839.    *******************************************************************************
  840.  
  841.    procedure BottomButtonOnClick
  842.  
  843.    * Go to last record in current order
  844.    *******************************************************************************
  845.  
  846.    go bottom
  847.  
  848.  
  849.    *******************************************************************************
  850.  
  851.    procedure OnNavigate
  852.  
  853.    * Procedure called when navigating through Music table.
  854.    * Makes sure appropriate buttons are grayed out when at first/last record.
  855.    *******************************************************************************
  856.    local curRec
  857.  
  858.    if form.inEditView           && If form in Edit view
  859.       curRec = recno()
  860.       do case
  861.          case curRec = form.firstRec .or. bof()
  862.             CLASS::DisableButton(form.topMusicButton)
  863.             CLASS::EnableButton(form.bottomMusicButton)
  864.             CLASS::EnableButton(form.nextMusicButton)
  865.             CLASS::DisableButton(form.prevMusicButton)
  866.          case curRec = form.lastRec .or. eof()
  867.             CLASS::DisableButton(form.bottomMusicButton)
  868.             CLASS::EnableButton(form.topMusicButton)
  869.             CLASS::EnableButton(form.prevMusicButton)
  870.             CLASS::DisableButton(form.nextMusicButton)
  871.          otherwise
  872.             CLASS::EnableButton(form.nextMusicButton)
  873.             CLASS::EnableButton(form.bottomMusicButton)
  874.             CLASS::EnableButton(form.prevMusicButton)
  875.             CLASS::EnableButton(form.topMusicButton)
  876.       endcase
  877.    endif
  878.  
  879.    ******************************************************************************
  880.  
  881.    procedure More
  882.  
  883.    * Procedure called when MoreButton is selected to display more information.
  884.    ******************************************************************************
  885.  
  886.    this.text = "L&ess"
  887.    this.helpId = "Less"
  888.    this.OnClick = CLASS::Less
  889.    this.SpeedTip = "See basic information"
  890.    this.StatusMessage = "See the basic information.  Press F1 for Help."
  891.    form.width = 100.0
  892.  
  893.    * Make extra controls visible
  894.    form.labelText.visible = .T.
  895.    form.labelEntry.visible = .T.
  896.    form.labelAbbrText.visible = .T.
  897.    form.labelAbbrEntry.visible = .T.
  898.    form.catalogText.visible = .T.
  899.    form.catalogEntry.visible = .T.
  900.    form.vpcText.visible = .T.
  901.    form.vpcEntry.visible = .T.
  902.    form.upcText.visible = .T.
  903.    form.upcEntry.visible = .T.
  904.    form.dividerRect.visible = .T.
  905.  
  906.  
  907.    ******************************************************************************
  908.  
  909.    procedure Less
  910.  
  911.    * Procedure called when MoreButton is selected to display less information.
  912.    ******************************************************************************
  913.  
  914.    form.width = form.dividerRect.left
  915.    form.moreMusicButton.text = "&More..."
  916.    form.moreMusicButton.helpId = "More"
  917.    form.moreMusicButton.OnClick = CLASS::More
  918.    this.SpeedTip = "See more information"
  919.    form.moreMusicButton.StatusMessage = "See more information.  Press F1 for Help."
  920.  
  921.    * Make extra controls invisible
  922.    form.labelText.visible = .F.
  923.    form.labelEntry.visible = .F.
  924.    form.labelAbbrText.visible = .F.
  925.    form.labelAbbrEntry.visible = .F.
  926.    form.catalogText.visible = .F.
  927.    form.catalogEntry.visible = .F.
  928.    form.vpcText.visible = .F.
  929.    form.vpcEntry.visible = .F.
  930.    form.upcText.visible = .F.
  931.    form.upcEntry.visible = .F.
  932.    form.dividerRect.visible = .F.
  933.  
  934.  
  935.  
  936.    *******************************************************************************
  937.  
  938.    procedure UpdateOrderControls(textControl, entryControl)
  939.  
  940.    * Update field colors according to current order
  941.    *******************************************************************************
  942.  
  943.    if form.inEditView .and. .not. empty(textControl)
  944.       form.orderText.colornormal = "n/w"
  945.       form.orderEntry.colornormal = "r/w"
  946.       show object form.orderText
  947.       show object form.orderEntry
  948.       form.orderText = textControl
  949.       form.orderEntry = entryControl
  950.       form.orderText.colornormal = "r/w"
  951.       form.orderEntry.colornormal = "w+/r"
  952.       show object form.orderText
  953.       show object form.orderEntry
  954.    endif
  955.  
  956.  
  957.    *******************************************************************************
  958.  
  959.    procedure EnableButton(b)
  960.  
  961.    * Enables parameter button.
  962.    *******************************************************************************
  963.  
  964.    b.enabled = .T.
  965.    b.tabstop = .T.
  966.  
  967.  
  968.    *******************************************************************************
  969.  
  970.    procedure DisableButton(b)
  971.  
  972.    * Disables parameter button.
  973.    *******************************************************************************
  974.  
  975.    b.enabled = .F.
  976.    b.tabstop = .F.
  977.  
  978.  
  979.    *******************************************************************************
  980.  
  981.    procedure ShowArtistsView(menu, speedMenu)
  982.  
  983.    * Displays information ordered by Artist.
  984.    *******************************************************************************
  985.  
  986.    if order() <> "ARTIST"                     && If not already ordered by Artist
  987.       set order to artist
  988.       if form.inEditView                      && Check if in Edit Mode
  989.          CLASS::ChangeOrder(form.artistText, form.artistEntry, menu, speedMenu)
  990.       else
  991.          CLASS::ChangeOrder(.F., .F., menu, speedMenu)
  992.       endif
  993.    endif
  994.  
  995.  
  996.    *******************************************************************************
  997.  
  998.    procedure ShowTitlesView(menu, speedMenu)
  999.  
  1000.    * Displays information ordered by Title.
  1001.    *******************************************************************************
  1002.  
  1003.    if order() <> "TITLE"                      && If not already ordered by Title
  1004.       set order to title
  1005.       if form.inEditView                      && Check if in Edit Mode
  1006.          CLASS::ChangeOrder(form.titleText, form.titleEntry, menu, speedMenu)
  1007.       else
  1008.          CLASS::ChangeOrder(.F., .F., menu, speedMenu)
  1009.       endif
  1010.    endif
  1011.  
  1012.  
  1013.    *******************************************************************************
  1014.  
  1015.    procedure ShowRankView(menu, speedMenu)
  1016.  
  1017.    * Displays information ordered by Rank.
  1018.    *******************************************************************************
  1019.  
  1020.    if order() <> "RANK"                       && If not already ordered by Rank
  1021.       set order to rank
  1022.       if form.inEditView                      && Check if in Edit Mode
  1023.          CLASS::ChangeOrder(form.rankText, form.rankEntry, menu, speedMenu)
  1024.       else
  1025.          CLASS::ChangeOrder(.F., .F., menu, speedMenu)
  1026.       endif
  1027.    endif
  1028.  
  1029.  
  1030.  
  1031.    *******************************************************************************
  1032.  
  1033.    procedure ChangeOrder(textControl, entryControl, menuOrderSelected, speedMenu)
  1034.  
  1035.    * Changes current display order of information.
  1036.    *******************************************************************************
  1037.    private  curOrder
  1038.  
  1039.    curOrder = order()
  1040.    form.orderMenu.checked = .F.
  1041.    form.speedOrderMenu.checked = .F.
  1042.    form.orderMenu = menuOrderSelected
  1043.    form.speedOrderMenu = speedMenu
  1044.    form.orderMenu.checked = .T.
  1045.    form.speedOrderMenu.checked = .T.
  1046.  
  1047.    * Do calculations in temp workarea
  1048.    use music in select() again alias temp
  1049.    select temp
  1050.    set order to &curOrder
  1051.    go bottom
  1052.    form.lastRec = recno()          && For checking for eof/bof when skipping
  1053.    go top
  1054.    form.firstRec = recno()
  1055.    select music
  1056.    use in temp
  1057.                                    && Update current order controls
  1058.    form.UpdateOrderControls(textControl, entryControl)
  1059.  
  1060.  
  1061.    ******************************************************************************
  1062.  
  1063.    procedure ReassignOrder
  1064.  
  1065.    * Reassigns references to order text and entry.
  1066.    ******************************************************************************
  1067.    private order
  1068.  
  1069.    order = setto("order")
  1070.    do case
  1071.       case order = "RANK"
  1072.          form.UpdateOrderControls(form.rankText, form.rankEntry)
  1073.       case order = "ARTIST"
  1074.          form.UpdateOrderControls(form.artistText, form.artistEntry)
  1075.       case order = "TITLE"
  1076.          form.UpdateOrderControls(form.titleText, form.titleEntry)
  1077.    endcase
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083. ENDCLASS
  1084.  
  1085.  
  1086. *******************************************************************************
  1087. *******************************************************************************
  1088. CLASS IMAGEFORM OF FORM
  1089.  
  1090. * Class for displaying album covers in a modal form
  1091. *******************************************************************************
  1092.  
  1093.    this.Height =         17.68
  1094.    this.Width =         44.37
  1095.    this.Top =          3.03
  1096.    this.Left =         21.59
  1097.    this.Text = "Cover"
  1098.    this.MDI =  .F.
  1099.    this.ColorNormal = "W"
  1100.  
  1101.    DEFINE RECTANGLE IMAGERECT OF THIS;
  1102.        PROPERTY;
  1103.          Height         15.55,;
  1104.          Width         44.20,;
  1105.          Top          0.10,;
  1106.          Left          0.17,;
  1107.          Border .T.,;
  1108.          Text "",;
  1109.          ColorNormal "W"
  1110.  
  1111.    DEFINE IMAGE COVERIMAGE OF THIS;
  1112.        PROPERTY;
  1113.          Height         14.80,;
  1114.          Width         42.50,;
  1115.          Top          0.41,;
  1116.          Left          1.02,;
  1117.          Alignment          1,;
  1118.          DataSource "BINARY MUSIC->COVER"
  1119.  
  1120.    DEFINE CLOSEMBUTTON CLOSEIMAGEBUTTON OF THIS;
  1121.        PROPERTY;
  1122.          Top         16.16,;
  1123.          Left         16.15
  1124.  
  1125.  
  1126. ENDCLASS
  1127.  
  1128.  
  1129.  
  1130.